package commonServer;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class CommonServer {

	public static final int PORT = 4010;

	public static void main(String args[]) {

		try {
			/* Creates the remote object. */

			Registry registry;
			try {
				registry = LocateRegistry.createRegistry(PORT);
			} catch (RemoteException exc) {
				registry = LocateRegistry.getRegistry(PORT);
			}
			IServer f = new ServerCentral("Server");
			registry.rebind("Server", f);
			// Naming.rebind("Server", f);

			System.out.println("Object is registered.");
			System.out.println("Now server is waiting for client request");

		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("FileServer: " + e);
		}
	}
}
